<template>
  <u-popup :show="show" mode="center" @close="closeHandle" bgColor="transparent">
    <view 
      class="eshop-consult-modal"
      :style="{backgroundImage:'url('+staticImgs.bg+')'}"
    >
      <view class="btn-wrapper" @click="confirmHandle" style="opacity: 0;">
        <image class="img" :src="staticImgs.btnImg" mode=""></image>
      </view>
    </view>
  </u-popup>
</template>

<script>
  import {checkinDaily,getDailyCheckinInfo,checkUserTodyIsCheckin} from '@/common/api/dailyCheckin.js'
  import { debounce } from 'lodash'

  import {STORE_VAR} from '@/common/dict.js'
  export default{
    props:{
      visible:{
        type:Boolean,
        default:false
      },
    },
    data() {
      return {
        show: false,
        staticImgs: {
          bg: this.imgBaseURL + '/scl/scl-live-modal.png',
          btnImg:  this.imgBaseURL + '/consult/eshop-consult-modal-btn.png',
        },
        loading:false
      }
    },
    watch:{
      visible:{
        handler(val){
          this.show = val
        },
        immediate:true
      }
    },
    methods:{
      // show: debounce(async function(){
      //   if(this.loading){
      //     return false
      //   }
      //   this.loading = true
      //   const {data:wRes} = await checkinDaily()
      //   if(wRes.success){
      //     console.log('------save-----')
      //     uni.setStorageSync(STORE_VAR.showDailyCheckinCouponPopup,'Y')
      //   }
      //   const {data:ddRes} = await checkUserTodyIsCheckin()
        
      //   this.dayCount = ddRes.data.visaAllToDay || 1
      //   const {data:dRes} = await getDailyCheckinInfo()
      //   this.text = dRes.data.title
        
      //   this.visible = true
      //   setTimeout(()=>{
      //     this.loading = false
      //   },1500)

      // },1000),
      confirmHandle(){
        this.$emit('ok')
      },
      closeHandle(){
        this.show = false
        this.$emit('close')
      }
    }
  }
</script>

<style lang="scss" scoped>
  .eshop-consult-modal{
    width: 580rpx;
    height: 672rpx;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    box-sizing: border-box;
    // padding: 106rpx 94rpx;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    
    .btn-wrapper{
      width: 330rpx;
      height: 104rpx;
      margin-bottom: 54rpx;
      
      .img{
        width: 100%;
        height: 100%;
      }
    }
    
  }
</style>